/**
 * There are <a href="https://github.com/thinkgem/jeesite">JeeSite</a> code generation
 */
package com.chlitina.store.modules.expert.entity;

import javax.persistence.CascadeType;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.Table;
import javax.validation.constraints.NotNull;

import org.hibernate.annotations.Cache;
import org.hibernate.annotations.CacheConcurrencyStrategy;
import org.hibernate.annotations.NotFound;
import org.hibernate.annotations.NotFoundAction;

import com.chlitina.store.common.persistence.BaseEntity;

/**
 *  方案产品步骤详细Entity
 * @author liujiang
 * @version 2013-08-19
 */
@Entity
@Table(name = "solution_face_product_mix_detail")
@Cache(usage = CacheConcurrencyStrategy.READ_WRITE)
public class SolutionFaceProductMixDetail extends BaseEntity {
	
	private static final long serialVersionUID = 1L;
	private Long id; 		// 编号
	private SolutionFaceProductMix solutionFaceProductMix; 		// 产品搭配组合编号
	private Product product; 		// 产品
	private float mix_ratio; // 混合比例，取值：0.5 1 1.5 2 2.5 3 3.5 4 4.5 5

	public SolutionFaceProductMixDetail() {
	}

	public SolutionFaceProductMixDetail(Long id){
		this();
		this.id = id;
	}
	
	@Id
	@GeneratedValue(strategy = GenerationType.IDENTITY)
	public Long getId() {
		return id;
	}

	public void setId(Long id) {
		this.id = id;
	}
	
	@ManyToOne(cascade={CascadeType.REFRESH},fetch = FetchType.LAZY)
	@JoinColumn(name="SFPM_ID")
	@NotFound(action = NotFoundAction.IGNORE)
	@Cache(usage = CacheConcurrencyStrategy.READ_WRITE)
	@NotNull
	public SolutionFaceProductMix getSolutionFaceProductMix() {
		return solutionFaceProductMix;
	}

	public void setSolutionFaceProductMix(SolutionFaceProductMix solutionFaceProductMix) {
		this.solutionFaceProductMix = solutionFaceProductMix;
	}
	
	@ManyToOne(cascade={CascadeType.REFRESH}, fetch = FetchType.LAZY)
	@JoinColumn(name="product_id")
	@NotFound(action = NotFoundAction.IGNORE)
	@Cache(usage = CacheConcurrencyStrategy.READ_WRITE)
	@NotNull
	public Product getProduct() {
		return product;
	}

	public void setProduct(Product product) {
		this.product = product;
	}
	
	public float getMix_ratio() {
		return mix_ratio;
	}

	public void setMix_ratio(float mix_ratio) {
		this.mix_ratio = mix_ratio;
	}
}